package com.qf.j2205.service;

import com.qf.j2205.entity.Dpt;
import com.qf.j2205.util.DruidUtil;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.List;


/**
 * @ClassName Test01
 * @Description TODO
 * @Author 16222
 * @Date 2022/8/22 19:07
 * @Version 1.0
 **/
public class Test01 {
    public static void main(String[] args) throws SQLException {

        DataSource dataSource = DruidUtil.getDataSource();
        QueryRunner queryRunner = new QueryRunner(dataSource);
        String sql = "select * from dpt";
        List<Dpt> query = queryRunner.query(sql, new BeanListHandler<Dpt>(Dpt.class));
        System.out.println(query);


    }


}
